import request from '@/utils/request'

const base_course_API = '/eduservice/course'

export default {
  // 添加课程信息
  saveCourseInfo(CourseInfoVo) {
    return request({
      url: `${base_course_API}/addCourseInfo`,
      method: 'post',
      data: CourseInfoVo
    })
  },

  // 查询所有讲师
  findAllTeacher() {
    return request({
      url: '/eduservice/teacher/selectAll',
      method: 'get'
    })
  },

  // 根据课程id查询课程信息
  getCourseById(courseId) {
    return request({
      url: `${base_course_API}/getCourseById/${courseId}`,
      method: 'get'
    })
  },

  // 修改课程信息
  updateCourseInfo(CourseInfoVo) {
    return request({
      url: `${base_course_API}/updateCourseInfo`,
      method: 'post',
      data: CourseInfoVo
    })
  },

  // 查询发布课程信息
  selectCoursePublishVoById(courseId) {
    return request({
      url: `${base_course_API}/selectCoursePublishVoById/${courseId}`,
      method: 'get'
    })
  },

  // 课程分页
  // coursePageList/{current}/{limit}
  pageCourseCondition(courseQuery, current, limit) {
    return request({
      url: `${base_course_API}/pageCourseCondition/${current}/${limit}`,
      method: 'post',
      data: courseQuery
    })
  },

  // 根据课程id删除课程
  deleteCourseByCourseId(courseId) {
    return request({
      url: `${base_course_API}/deleteCourseByCourseId/${courseId}`,
      method: 'delete'
    })
  }
}
